package com.key.service.impl;

import com.key.common.vo.AssetListVO1;
import com.key.mapper.AssetListMapper;
import com.key.service.AssetListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：朕
 * @Package：com.key.service.impl
 * @Project：ams_system
 * @name：AssetListServiceImpl
 * @Date：2023/2/22 22:07
 * @Filename：AssetListServiceImpl
 */
@Service
public class AssetListServiceImpl implements AssetListService {

    @Autowired
    private AssetListMapper assetListMapper;

    /**
     * 显示资产
     * @return
     */
    @Override
    public List<AssetListVO1> findAssetsList() {
        List<AssetListVO1> assetListVO1s = assetListMapper.findAssetsList();
        return assetListVO1s;
    }

    /**
     *根据公司名称查询资产
     * @return
     */
    @Override
    public List<AssetListVO1> findAssetListByCompanyName(String companyName) {
        List<AssetListVO1> assetListVO1s = assetListMapper.findAssetListByCompanyName(companyName);
        return assetListVO1s;
    }

    /**
     * 根据部门名称查询资产
     * @return
     */
    @Override
    public List<AssetListVO1> findAssetListByDepartment(String department) {
        List<AssetListVO1> assetListVO1s = assetListMapper.findAssetListByDepartmentName(department);
        return assetListVO1s;
    }

    /**
     *
     * 高级搜索
     * @param adm
     * @return
     */
    @Override
    public List<AssetListVO1> findAssetListByAnd(String adm) {
        List<AssetListVO1> assetListVO1s = assetListMapper.findAssetListByCode(adm);
        List<AssetListVO1> assetListVO1s1 = assetListMapper.findAssetListByType(adm);
        if(assetListVO1s.size()>0){
            return assetListVO1s;
        }else if(assetListVO1s1.size()>0){
            return assetListVO1s1;
        }
        return assetListVO1s;
    }
}
